from django.db import models

from apps.aiauth.models import Users
from apps.setup.models import Experts, Timeslot


class CareerplanExperts(models.Model):
    id = models.BigAutoField(db_column='id', primary_key=True)
    careerplan_id = models.ForeignKey('Careerplan', models.DO_NOTHING, related_name='careerplanexperts',
                                      db_column='careerplan_id', blank=True, null=True)
    experts_id = models.ForeignKey(Experts, models.DO_NOTHING, blank=True, null=True, db_column='experts_id')
    create_time = models.DateTimeField()

    class Meta:
        db_table = 'careerplan_experts'
        verbose_name_plural = '职业规划-专家映射表'
        unique_together = ('careerplan_id', 'experts_id')


class Careerplan(models.Model):
    careerplan_id = models.BigAutoField(primary_key=True, db_column='careerplan_id')
    title = models.CharField(max_length=255, blank=True, null=True)
    sub_message = models.TextField(blank=True, null=True)
    timeslot_id = models.ForeignKey(Timeslot, models.DO_NOTHING, blank=True, null=True, db_column='timeslot_id')
    user_id = models.ForeignKey(Users, models.DO_NOTHING, blank=True, null=True, db_column='user_id',
                                related_name='user_careerplan')
    content = models.TextField(blank=True, null=True)
    content_html = models.TextField(blank=True, null=True)
    is_studymaster = models.BooleanField(blank=True, default=False)
    create_time = models.DateTimeField()
    update_time = models.DateTimeField(blank=True, null=True)
    publish_time = models.DateTimeField(blank=True, null=True)
    delete_time = models.DateTimeField(blank=True, null=True)
    status = models.IntegerField(blank=True, null=True)
    is_dot = models.BooleanField(blank=True, default=False)

    class Meta:
        db_table = 'careerplan'
        verbose_name_plural = '职业规划表'
